package com.mvp.method2.retrofit;

import com.hhx.baselibrary.api.RetrofitManager;
import com.mvp.method2.IApiService;

/**
 * Created by Administrator on 2019/3/6.
 */

public class APIServiceManager {

    public static final String BASE_URL = "https://api.haominglijia.com/";

    private static APIServiceManager instance;
    private static volatile IApiService apiService;

    public APIServiceManager() {
    }

    public static APIServiceManager getInstance() {
        if (instance == null) {
            synchronized (APIServiceManager.class) {
                if (instance == null) {
                    instance = new APIServiceManager();
                }
            }
        }
        return instance;
    }

    private <T> T create(Class<T> service) {

        return RetrofitManager.getInstance().getSSLRetrofit(BASE_URL).create(service);
    }

    public IApiService getApiService() {
        apiService = create(IApiService.class);
        return apiService;
    }

}
